﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>创建规则</title>
    <script type="text/javascript">
        //创建规则.
        function Del(mypk, nodeid) {
            if (mypk == '') {
                alert("默认发送不允许创建规则，您可以修改。");
                return;
            }
            if (window.confirm('您确定要创建规则吗?') == false)
                return;
            window.location.href = 'Method.htm?MyPK=' + mypk + '&DoType=Del&FrmID=' + nodeid;
        }
    </script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <base target="_self" />
    <script type="text/javascript">
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }

        function Help() {
            var url = "http://ccbpm.mydoc.io";
            window.open(url);
        }
 
    </script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {
            var frmID = GetQueryString("FrmID");
            var en = new Entity("BP.Frm.FrmDict", frmID);
            GenerFullAllCtrlsVal(en);

        });

        function Save() {
            //创建实体.
            var frmID = GetQueryString("FrmID");
            var en = new Entity("BP.Frm.FrmDict", frmID);
            en.CopyForm();
            en.SetPKVal(frmID);
            en.Update();
            window.location.href = window.location.href;
        }

        //设置岗位.
        function OpenDot2DotStations() {

            var frmID = GetQueryString("FrmID");

            var url = "../../Comm/RefFunc/Dot2Dot.htm?EnName=BP.Frm.FrmTemplate&Dot2DotEnsName=BP.Frm.FrmStationCreates";
            url += "&AttrOfOneInMM=FrmID&AttrOfMInMM=FK_Station&EnsOfM=BP.WF.Port.Stations";
            url += "&DefaultGroupAttrKey=FK_StationType&FrmID=" + frmID + "&PKVal=" + frmID;

            OpenEasyUiDialogExt(url, '设置岗位', 800, 500, true);
        }
        //设置岗位新方式.
        function OpenNewStations() {

            var frmID = GetQueryString("FrmID");

            var url = "../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.Frm.FrmTemplate&Dot2DotEnsName=BP.Frm.FrmStationCreates&Dot2DotEnName=BP.Frm.FrmStationCreate&AttrOfOneInMM=FrmID&AttrOfMInMM=FK_Station&EnsOfM=BP.WF.Port.Stations&DefaultGroupAttrKey=FK_StationType&FrmID=" + frmID + "&PKVal=" + frmID;
            OpenEasyUiDialogExt(url, '设置岗位', 800, 500, true);
        }
        //绑定人员
        function BindEmps() {

            var frmID = GetQueryString("FrmID");
            var url = "../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.Frm.FrmTemplate&Dot2DotEnsName=BP.Frm.FrmEmpCreates&Dot2DotEnName=BP.Frm.FrmEmpCreate&AttrOfOneInMM=FrmID&AttrOfMInMM=FK_Emp&EnsOfM=BP.Port.Emps&DefaultGroupAttrKey=FK_Dept";
            url += '&FrmID=' + frmID + '&PKVal=' + frmID + "&M=" + Math.random();

            OpenEasyUiDialogExt(url, '设置人员', 800, 500, true);

        }
        //弹出新页面
        function BindDepts() {

            var frmID = GetQueryString("FrmID");
            var url = "../../Comm/RefFunc/Branches.htm?EnName=BP.Frm.FrmTemplate&Dot2DotEnsName=BP.Frm.FrmDeptCreates&Dot2DotEnName=BP.Frm.FrmDeptCreate&AttrOfOneInMM=FrmID&AttrOfMInMM=FK_Dept&EnsOfM=BP.Port.Depts&DefaultGroupAttrKey=";
            url += url + '&FrmID=' + frmID + '&PKVal=' + frmID;
            OpenEasyUiDialogExt(url, "绑定部门", 800, 600, true);
        }

    </script>
</head>
<body onkeypress="Esc();" style="font-size: smaller">
    <table id="Table1" style="width: 100%">
        <caption>
            数据创建规则
        </caption>
        <!-- 规则1 -->
        <tr>
            <th>
                <label>
                    <input type="checkbox" value="1" checked="true" id="CBPara_CreateEveryone" name="CBPara_CreateEveryone" />
                    任何人都可以创建</label>
            </th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li>所有的人都可以创建。</li>
                    <li>如果选择改规则，其他的规则都不用设置了。</li>
                </ul>
            </td>
        </tr>
        <!-- end规则1 -->
        <!-- 规则2 -->
        <tr>
            <th>
                <label>
                    <input type="checkbox" value="1" id="CBPara_CreateByStations" name="CBPara_CreateByStations" />
                    启用按照岗位计算创建规则</label>
            </th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li><a href="javascript:OpenDot2DotStations()">设置/更改岗位(旧版本)</a></li>
                    <li><a href="javascript:OpenNewStations()">设置/更改岗位（左右树结构）</a> </li>
                </ul>
            </td>
        </tr>
        <!-- end规则2 -->
        <!-- 规则3 -->
        <tr>
            <th>
                <label>
                    <input type="checkbox" value="1" id="CBPara_CreateByEmps" name="CBPara_CreateByEmps" />
                    启用按照设置的人员计算创建规则</label>
            </th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li><a href="javascript:BindEmps()">设置/更改人员</a></li>
                </ul>
            </td>
        </tr>
        <!-- end规则3 -->
        <!-- 规则4 -->
        <tr>
            <th>
                <label>
                    <input type="checkbox" value="1" id="CBPara_CreateByDepts" name="CBPara_CreateByDepts" />
                    启用按照设置的部门计算创建规则</label>
            </th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li><a href="javascript:BindDepts()">设置/更改部门</a></li>
                </ul>
            </td>
        </tr>
        <!-- end规则4 -->
    </table>
    <input type="button" id="Btn_Save" value="保存" onclick="Save()" />
    <input type="button" id="Btn_Help" value="我需要帮助" onclick="Help()" />
</body>
</html>
